You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_job_edit_costs.N.py 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Tue Nov 3 20:23:25 2020
  5. @author: ljia
  6. """
  7. import os
  8. import re
  9. def get_job_script(arg, params):
  10. ged_method = params[0]
  11. multi_method = params[1]
  12. job_name_label = r"rep." if multi_method == 'repeats' else r""
  13. script = r"""
  14. #!/bin/bash
  15. #SBATCH --exclusive
  16. #SBATCH --job-name="st.""" + job_name_label + r"N" + arg + r"." + ged_method + r""""
  17. #SBATCH --partition=tlong
  18. #SBATCH --mail-type=ALL
  19. #SBATCH --mail-user=jajupmochi@gmail.com
  20. #SBATCH --output="outputs/output_edit_costs.""" + multi_method + r".N." + ged_method + r"." + arg + r""".txt"
  21. #SBATCH --error="errors/error_edit_costs.""" + multi_method + r".N." + ged_method + r"." + arg + r""".txt"
  22. #
  23. #SBATCH --ntasks=1
  24. #SBATCH --nodes=1
  25. #SBATCH --cpus-per-task=1
  26. #SBATCH --time=300:00:00
  27. #SBATCH --mem-per-cpu=4000
  28. srun hostname
  29. srun cd /home/2019015/ljia02/graphkit-learn/gklearn/experiments/ged/stability
  30. srun python3 edit_costs.""" + multi_method + r".N." + ged_method + r".py " + arg
  31. script = script.strip()
  32. script = re.sub('\n\t+', '\n', script)
  33. script = re.sub('\n +', '\n', script)
  34. return script
  35. if __name__ == '__main__':
  36. params_list = [('IPFP', 'nums_sols'),
  37. ('IPFP', 'repeats'),
  38. ('bipartite', 'max_num_sols'),
  39. ('bipartite', 'repeats')]
  40. N_list = [10, 50, 100]
  41. for params in params_list[1:]:
  42. for N in [N_list[i] for i in [0, 1, 2]]:
  43. job_script = get_job_script(str(N), params)
  44. command = 'sbatch <<EOF\n' + job_script + '\nEOF'
  45. # print(command)
  46. os.system(command)
  47. # os.popen(command)
  48. # output = stream.readlines()

A Python package for graph kernels, graph edit distances and graph pre-image problem.