Spaces:
Runtime error
Runtime error
File size: 18,405 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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
import numpy as np
import sys
N_arr = np.arange(6, 36, 2)
# N_arr = np.append(N_arr, np.arange(41, 51, 1))
# _partition = 'hourly'
# sim_pack = 'qiskit'
# task = 'hdyn'
# com_cap = 'st'
# prec = 'dp'
sim_pack = sys.argv[1]
task = sys.argv[2]
com_cap = sys.argv[3]
prec = sys.argv[4]
# print("hello: ", sim_pack)
# print(task)
for ind, N in enumerate(N_arr):
with open('{}_{}_{}_{}.sh'.format(task, com_cap, prec, N), 'a') as job_file:
job_file.write('#!/bin/bash -l\n')
job_file.write('#SBATCH --job-name={}_{}_{}_{}_{}\n'.format(sim_pack, task, com_cap, prec, N))
if com_cap == 'gpu':
job_file.write('#SBATCH --cluster=gmerlin6\n')
job_file.write('#SBATCH --hint=nomultithread\n')
job_file.write('#SBATCH --nodes=1\n')
job_file.write('#SBATCH --ntasks=1\n')
if sim_pack == 'qulacs':
job_file.write('#SBATCH --partition=gpu-short\n')
job_file.write('#SBATCH --gpus=geforce_rtx_2080_ti:1\n')
else:
job_file.write('#SBATCH --partition=gwendolen\n')
job_file.write('#SBATCH --account=gwendolen\n')
job_file.write('#SBATCH --gpus=A100:1\n')
if N < 30:
job_file.write('#SBATCH --mem=30G\n')
else:
if sim_pack == 'qulacs':
job_file.write('#SBATCH --mem=100G\n')
else:
job_file.write('#SBATCH --mem=900G\n')
if N < 30:
job_file.write('#SBATCH --time=00:30:00\n')
else:
job_file.write('#SBATCH --time=01:00:00\n')
elif com_cap == 'gpu1' or com_cap == 'gpu2' or com_cap == 'gpu4' or com_cap == 'gpu8':
job_file.write('#SBATCH --cluster=gmerlin6\n')
job_file.write('#SBATCH --hint=nomultithread\n')
job_file.write('#SBATCH --nodes=1\n')
ngpus = int(com_cap[-1])
if sim_pack == 'cuquantum_qiskit':
job_file.write('#SBATCH --ntasks={}\n'.format(ngpus))
job_file.write('#SBATCH --partition=gwendolen\n')
job_file.write('#SBATCH --account=gwendolen\n')
ngpus = int(com_cap[-1])
job_file.write('#SBATCH --gpus=A100:{}\n'.format(ngpus))
if N < 30:
job_file.write('#SBATCH --mem=30G\n')
else:
job_file.write('#SBATCH --mem=900G\n')
if N < 30:
job_file.write('#SBATCH --time=00:30:00\n')
else:
job_file.write('#SBATCH --time=01:00:00\n')
else:
if N < 26:
job_file.write('#SBATCH --partition=hourly\n')
else:
job_file.write('#SBATCH --partition=general\n')
if com_cap == 'st':
job_file.write('#SBATCH --hint=nomultithread\n')
job_file.write('#SBATCH --nodes=1\n')
job_file.write('#SBATCH --ntasks=1\n')
job_file.write('#SBATCH --cpus-per-task=1\n')
job_file.write('#SBATCH --ntasks-per-core=1\n')
elif com_cap == 'mt':
job_file.write('#SBATCH --hint=multithread\n')
job_file.write('#SBATCH --nodes=1\n')
job_file.write('#SBATCH --ntasks=1\n')
job_file.write('#SBATCH --cpus-per-task=42\n')
job_file.write('#SBATCH --ntasks-per-core=2\n')
if N < 26:
job_file.write('#SBATCH --mem=30G\n')
else:
job_file.write('#SBATCH --mem=300G\n')
if N < 26:
job_file.write('#SBATCH --time=01:00:00\n')
else:
job_file.write('#SBATCH --time=23:00:00\n')
job_file.write('#SBATCH [email protected]\n')
job_file.write('#SBATCH --mail-type=BEGIN,END,FAIL\n')
job_file.write('#SBATCH --output /data/user/gangap_a/{}_singular/{}/output_{}_{}/{}_{}_{}_{}.out\n'.format(task, sim_pack, com_cap, prec, task, com_cap, prec, N))
job_file.write('#SBATCH --error /data/user/gangap_a/{}_singular/{}/error_{}_{}/{}_{}_{}_{}.err\n'.format(task, sim_pack, com_cap, prec, task, com_cap, prec, N))
job_file.write('\n\n')
# job_file.write('module load anaconda\n')
# job_file.write('module load gcc/12.1.0\n')
# job_file.write('conda activate sim_{}\n'.format(sim_pack))
if sim_pack == 'projectq' or sim_pack == 'quest' or sim_pack == 'intel_qs_cpp' or sim_pack == 'svsim' or sim_pack == 'hybridq' or sim_pack == 'hiq' or sim_pack == 'qibo' or sim_pack == 'qibojit' or sim_pack == 'qrack_sch' or sim_pack == 'qrack_opt' or sim_pack == 'pennylane_l' or sim_pack == 'qpp' or sim_pack == 'qpanda' or sim_pack =='braket' or sim_pack == 'myqlm' or sim_pack == 'myqlm_cpp':
if com_cap == 'st':
job_file.write('OMP_NUM_THREADS=1\n')
job_file.write('export OMP_NUM_THREADS\n')
elif com_cap == 'mt':
job_file.write('OMP_NUM_THREADS=84\n')
job_file.write('export OMP_NUM_THREADS\n')
elif sim_pack == 'qulacs':
if com_cap == 'st':
job_file.write('OMP_NUM_THREADS=1\n')
job_file.write('export OMP_NUM_THREADS\n')
job_file.write('QULACS_NUM_THREADS=1\n')
job_file.write('export QULACS_NUM_THREADS\n')
elif com_cap == 'mt':
job_file.write('OMP_NUM_THREADS=84\n')
job_file.write('export OMP_NUM_THREADS\n')
job_file.write('QULACS_NUM_THREADS=84\n')
job_file.write('export QULACS_NUM_THREADS\n')
elif sim_pack == 'yao':
if com_cap == 'st':
job_file.write('OMP_NUM_THREADS=1\n')
job_file.write('export OMP_NUM_THREADS\n')
job_file.write('JULIA_NUM_THREADS=1\n')
job_file.write('export JULIA_NUM_THREADS\n')
elif com_cap == 'mt':
job_file.write('OMP_NUM_THREADS=84\n')
job_file.write('export OMP_NUM_THREADS\n')
job_file.write('JULIA_NUM_THREADS=84\n')
job_file.write('export JULIA_NUM_THREADS\n')
job_file.write('export SRUN_CPUS_PER_TASK=$SLURM_CPUS_PER_TASK\n')
if sim_pack == 'hiq':
job_file.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/{}/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/{}_singular/{}/run_files_{}_{}/:/sim_lib/hiq/HiQsimulator/examples/run_files_{}_{},/data/user/gangap_a/{}_singular/{}/data_{}_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec /data/user/gangap_a/singularity_images/hiq_qucos_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'intel_qs_cpp':
job_file.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/{}/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/{}_singular/intel_qs_cpp/:/home\"\n'.format(task, sim_pack, com_cap, prec, task))
# if N==N_arr[0]:
# job_file.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}.sh\n'.format(task, com_cap, prec))
# job_file.write('sleep 100\n')
job_file.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
# else:
# job_file.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'quest':
# job_file.write('export APPTAINER_BIND=\"/data/user/gangap_a/{}_singular/{}/bash_scripts_{}_{}/:/brf,/data/user/gangap_a/{}_singular/{}/run_files_{}_{}/:/sim_lib/quest/QuEST/{}/run_files_{}_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, com_cap, prec))
job_file.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/quest/build_{}_{}:/sim_lib/quest/QuEST/build_{}_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, com_cap, prec, com_cap, prec))
if com_cap == 'st' or com_cap == 'mt':
job_file.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif com_cap == 'gpu':
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/qucos_gpu_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'qrack_sch' or sim_pack == 'qrack_opt':
if com_cap == 'st' or com_cap == 'mt':
job_file.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_st_{}:/bin_st_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, prec, prec))
job_file.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif com_cap == 'gpu':
job_file.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_gpu_{}:/bin_gpu_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, prec, prec))
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/qucos_gpu_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'qpp':
if com_cap == 'st' or com_cap == 'mt':
job_file.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_st_{}:/bin_st_{}\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, prec, prec))
job_file.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
# elif sim_pack == 'pennylane_l' and com_cap == 'gpu':
elif sim_pack == 'qulacs' and com_cap == 'gpu':
# job_file.write('module load cuda/11.5.1\n')
job_file.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/{}/data_{}_{}/"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/qucos_gpu_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'yao' and com_cap == 'gpu':
job_file.write('module load cuda/11.5.1\n')
job_file.write('bash /data/user/gangap_a/{}_singular/yao/bash_scripts_{}_{}/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, task, com_cap, prec, N))
elif sim_pack == 'pennylane_l' and com_cap == 'gpu':
job_file.write('module load anaconda\n')
job_file.write('conda activate sim_pennylane_gpu\n')
job_file.write('module load cuda/11.5.1\n')
job_file.write('bash /data/user/gangap_a/{}_singular/pennylane_l/bash_scripts_{}_{}/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, task, com_cap, prec, N))
elif sim_pack == 'qsimcirq' and com_cap == 'gpu':
job_file.write('module load anaconda\n')
job_file.write('conda activate sim_qsimcirq_a100\n')
job_file.write('module load cuda/11.4.3\n')
job_file.write('bash /data/user/gangap_a/{}_singular/qsimcirq/bash_scripts_{}_{}/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, task, com_cap, prec, N))
elif sim_pack == 'qpanda' and com_cap == 'gpu':
job_file.write('module load anaconda\n')
job_file.write('conda activate sim_qpanda_gpu\n')
job_file.write('module load cuda/11.4.3\n')
job_file.write('bash /data/user/gangap_a/{}_singular/qpanda/bash_scripts_{}_{}/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, task, com_cap, prec, N))
elif sim_pack == 'cuquantum_qiskit' and (com_cap == 'gpu' or com_cap == 'gpu1' or com_cap == 'gpu2' or com_cap == 'gpu4' or com_cap == 'gpu8'):
job_file.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/{}/data_{}_{}/\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/sim_cuq_nvidia.simg bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'cuquantum_qsimcirq' and (com_cap == 'gpu' or com_cap == 'gpu1' or com_cap == 'gpu2' or com_cap =='gpu4' or com_cap == 'gpu8'):
job_file.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/{}/data_{}_{}/\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/sim_cuq_nvidia.simg bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'cuda_quantum': # or com_cap == 'gpu1' or com_cap == 'gpu2' or com_cap =='gpu4' or com_cap == 'gpu8'):
if com_cap == 'st':
job_file.write('OMP_NUM_THREADS=1\n')
job_file.write('export OMP_NUM_THREADS\n')
job_file.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/{}/data_{}_{}/\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec /data/user/gangap_a/singularity_images/sim_cudaq_nvidia.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif com_cap == 'mt':
job_file.write('OMP_NUM_THREADS=84\n')
job_file.write('export OMP_NUM_THREADS\n')
job_file.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/{}/data_{}_{}/\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec /data/user/gangap_a/singularity_images/sim_cudaq_nvidia.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif com_cap == 'gpu':
job_file.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/{}/data_{}_{}/\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/sim_cudaq_nvidia.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
elif sim_pack == 'qibojit' and (com_cap == 'gpu1' or com_cap == 'gpu2' or com_cap =='gpu4' or com_cap == 'gpu8'):
job_file.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/{}/data_{}_{}/\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/qucos_gpu_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
else:
# if com_cap == 'gpu':
# job_file.write('module load cuda/11.5.1\n')
job_file.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/{}/data_{}_{}/\"\n'.format(task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec, task, sim_pack, com_cap, prec))
if com_cap == 'gpu':
job_file.write('singularity exec --nv /data/user/gangap_a/singularity_images/qucos_gpu_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
else:
job_file.write('singularity exec /data/user/gangap_a/singularity_images/qucos_sim.sif bash /brf/{}_{}_{}_{}.sh\n'.format(task, com_cap, prec, N))
|